'use strict';
app.service('modulesAdvertisementAddService',['$q','utilService',function($q,utilService){
    var _this_=this;

    //查询广告分类下拉框
    _this_.getList = function($scope){
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'advertise/type/list'
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错");
        });
        return deferred.promise;
    }


    //添加模块广告
    _this_.modulesAdvertiseAddVO={
        sort:0
    };
    _this_.addModulesAdvertise= function ($scope) {

        _this_.modulesAdvertiseAddVO.modulesId=$scope.modulesId;
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'modules/advertise',
            data:_this_.modulesAdvertiseAddVO,
            method:'POST'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }


}]);